package page244;

public class Test5 {
    //    去除字符串中的全部非数字字符
    public static String removeNonDigit(String s) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if (Character.isDigit(s.charAt(i))) {
                result.append(s.charAt(i));
            }
        }
        return result.toString();
    }

    public static void main(String[] args) {
        String s = "ab123you";
        String changeS = removeNonDigit(s);
        System.out.println(s);
        System.out.println(changeS);
    }


}
